
namespace gen {

    template <class FunctorT, class OperatorT>
	template <typename ContextT>
	domain<typename ContextT::iterator_t>
	number2<FunctorT, OperatorT>::evaluate(ContextT const& c) const
    {
		typedef typename ContextT::iterator_t iterator_t;
		typedef if_expr2<FunctorT>::if_expr2_initializator<ContextT> initializator_t;
		initializator_t init(m_expr, c);
		domain<iterator_t> result(c.domain().first(), c.domain().last(), init);

		int nb_value = m_value;
		if (m_value==ALL_ITEMS) nb_value = c.domain().last() - c.domain().first();
		if (m_op(nb_value, result.nbPositives())) {
			return result;
		}
		return domain<iterator_t>(c.domain().first(), c.domain().last(), false_initializator());
    }

    template <class FunctorT>
    inline number2<FunctorT>
    nbOfValid2_g(FunctorT const& f, int value)
    { 
        return number2<FunctorT>(f, value); 
    }

    template <class FunctorT, class OperatorT>
    inline number2<FunctorT, OperatorT>
    nbOfValid2_g(FunctorT const& f, int value, OperatorT const& op)
    { 
        return number2<FunctorT, OperatorT>(f, value, op); 
    }

}
